package com.qfjy.project.weixin.api.uploadMedia;


import com.qfjy.project.weixin.pojo.AccessToken;
import com.qfjy.project.weixin.util.WeixinUtil;
import org.springframework.beans.factory.annotation.Autowired;

public class UploadMedia {

    @Autowired
    private WeixinUtil weixinUtil;

    public final static String appId="wx90a0f1babf384cd7";
    public final static String appSecret = "ef110f43dccb6f65357075085d767392";
    public final static String TYPE_IMAGE = "image";

    public static void main(String[] args) {

        AccessToken accessToken = WeixinUtil.getAccessToken(appId, appSecret);
        System.out.println(accessToken);
        String token = accessToken.getToken();
        System.out.println(token);

        String uploadUrl = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token="+token+"&type="+TYPE_IMAGE;
        System.out.println(uploadUrl);
        WeixinUtil.httpRequest(uploadUrl,"POST","d://1.jpg");

    }


}
